Accents encoding bug fix

James Peret 8 years ago
parent
commit
1d98af31ac

+ 1 - 1
app/index.html

@@ -3,7 +3,7 @@
3 3
 
4 4
   <head>
5 5
     <title>Codex</title>
6
-    <meta charset="UTF-8">
6
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 7
     <!-- Stylesheets -->
8 8
     <link rel="stylesheet" href="../css/tomorrow-night-eighties.css">
9 9
     <link rel="stylesheet" href="../css/photon.min.css">

+ 3 - 1
app/scripts/controllers/note-view-ctrl.js

@@ -33,7 +33,9 @@ angular.module('codexApp.noteView', [])
33 33
 
34 34
     $scope.loadNoteView = function() {
35 35
       filesystem.readFile($scope.note.path, function(err, data) {
36
-        $scope.note.data = String.fromCharCode.apply(null, data)
36
+        //$scope.note.data = String.fromCharCode.apply(null, data);
37
+        $scope.note.data = new Buffer(data).toString('utf8')
38
+        console.log($scope.note.data);
37 39
         if(!$scope.$$phase) {
38 40
           $scope.$apply(function(){
39 41
             $scope.html_data = marked($scope.note.data);

+ 5 - 4
app/scripts/services/file-service.js

@@ -218,12 +218,13 @@ angular.module('codexApp')
218 218
 
219 219
   this.saveFile = function(file_path, content){
220 220
     var fs = require('fs');
221
-    fs.writeFile(file_path, content, 'utf-8', function(err) {
221
+    fs.writeFile(file_path, content, 'utf8', function(err) {
222 222
         if(err) {
223
-            return console.log(err);
223
+            console.log("-> ERROR SAVING FILE: " + file_path);
224
+            console.log(err);
225
+        } else {
226
+          console.log("-> FILE SAVED: " + file_path);
224 227
         }
225
-
226
-        console.log("-> FILE SAVED: " + file_path);
227 228
     });
228 229
   }
229 230
 

+ 1 - 1
app/views/note-edit.html

@@ -7,5 +7,5 @@
7 7
     firstLineNumber: 1,
8 8
     onLoad: aceLoaded,
9 9
     onChange: aceChanged
10
-  }" ng-model="raw_data" charset="utf-8"></div>
10
+  }" ng-model="raw_data" charset="utf8"></div>
11 11
 </div>